-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
O3-4280: implement Save a note in Visit Patient scenario #66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @Bawanthathilan! Just a few minor comments—please take a look. Regarding the test failures, it looks like the End Visit endpoint is returning a 400, which isn't related to this PR. I'll check it out, but feel free to look into it as well if you can.
return exec( | ||
httpService.saveVisitNote(patientUuid, currentUserUuid, visitNoteText) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation looks a bit weird.
} | ||
|
||
|
||
public HttpRequestActionBuilder saveDiagnosis(String patientUuid, String encounterUuid, String diagnosisUuid,String certainty, int rank) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this to a separate PR
@@ -42,4 +42,10 @@ public class Constants { | |||
public static final String ALLERGY_REACTION_UUID = "162553AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | |||
public static final String CODED_ALLERGEN_UUID = "71617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | |||
public static final String SEVERITY_UUID = "1498AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | |||
|
|||
//Save Visits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Save Visits | |
// Visit Notes |
I went through the logs of the test run and this was the error:
Which means the backend can't convert the response as in the requested format (custom representation). For some reason the provided custom representation for get visit is incorrect. The correct one should be: String customRepresentation = "custom:(uuid,display,voided,indication,startDatetime,stopDatetime," +
"encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display)))," +
"patient:(uuid,display)," +
"visitType:(uuid,name,display)," +
"attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value)," +
"location:(uuid,name,display))";
return http("Get Visits of Patient")
.get("/openmrs/ws/rest/v1/visit?patient=" + patientUuid + "&v=" + customRepresentation + "&includeInactive=false"); I just took the above from query params of the |
.exec(registry.addDrugOrder("#{patient_uuid}", "#{visitUuid}", "#{currentUserUuid}")) | ||
.exec(registry.addVisitNote("#{patient_uuid}", "#{currentUserUuid}")) | ||
.exec(registry.endVisit("#{patient_uuid}")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add some pauses to make it realistic. In real world, users takes time to perform actions. Also this may fix the Cannot contain encounters whose dates are after the stop of the visit.
error.
.exec(registry.addDrugOrder("#{patient_uuid}", "#{visitUuid}", "#{currentUserUuid}")) | |
.exec(registry.addVisitNote("#{patient_uuid}", "#{currentUserUuid}")) | |
.exec(registry.endVisit("#{patient_uuid}")); | |
.exec(registry.addDrugOrder("#{patient_uuid}", "#{visitUuid}", "#{currentUserUuid}")) | |
.pause(5) | |
.exec(registry.addVisitNote("#{patient_uuid}", "#{currentUserUuid}")) | |
.pause(10) | |
.exec(registry.endVisit("#{patient_uuid}")); |
The correct custom representation should be this I guess: The previous error of custom representation is still there, which complains encounters don't have an attribute called visitType. According to our previous custom representations, it was nested incorrectly. However I wonder why it works fine on dev3. Can you try below?
formatted version:
Update: The failing API call is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this done @Bawanthathilan ! 🎉
This pull request introduces the following changes to enhance the Save a note in Visit Patient scenario:
Ticket URL: https://openmrs.atlassian.net/browse/O3-4280